﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using e.Store.DataAccess;
using e.Store.Model.Entities;

namespace e.Store.Domain.Repositories
{
    public class ProductRepository : Repository<Product>
    {
        eStote_DBEntities _context;

        public ProductRepository(eStote_DBEntities context)
            : base(context)
        {
            dbSet = context.Set<Product>();
            _context = context;

        }

        public List<LoadAllProductsResult> LoadAllProducts()
        {
            return context.LoadAllProducts().ToList();
        }


        public List<ProductDetail> LoadAllProductDetails()
        {
            return context.ProductDetails.ToList();
        }

        public List<GetInvoiceDetailsResult> GetInvoiceDetails(long invoiceOID)
        {
            return context.GetInvoiceDetails().Where(c => c.InvoiceOID == invoiceOID).ToList();
        }

        public void Dispose()
        {
            //context.Dispose();
        }
    }
}
